<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Studyfav extends Model
{
    //
    protected $guarded = [];

    public function getFavByUidSidType($uid, $sid, $type)
    {
        return $this->where(function ($query) use ($uid, $sid) {
            return $query->where('userid', $uid)->where('studyid', $sid);
        })->WhereIn('type', [$type, $type * 100])->first();
    }
}
